package cn.zhong5.changzhoulocaltax.module.splash;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.OnClick;
import cn.zhong5.changzhoulocaltax.R;
import cn.zhong5.changzhoulocaltax.base.BaseActivity;
import cn.zhong5.changzhoulocaltax.module.web.WebViewActivity;

/**
 * Created by Sunman on 2017-12-4 0004.
 */

public class SplashActivity extends BaseActivity implements SplashContract.ISplashView
{
    private boolean isIn;

    @BindView(R.id.splash_iv_pic)
    ImageView mIvPic;
    @BindView(R.id.splash_tv_jump)
    TextView mTvJump;
    @BindView(R.id.splash_iv_defult_pic)
    ImageView mIvDefultPic;

    @Override
    protected int getContentViewLayoutID()
    {
        return R.layout.activity_splash;
    }

    @Override
    protected void initView(Bundle savedInstanceState)
    {
        // 先显示默认图
        mIvDefultPic.setImageDrawable(getResources().getDrawable(R.mipmap.img_transition_default));

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                jumpToMain();
            }
        }, 2500);
    }

    @OnClick(R.id.splash_tv_jump)
    public void onClick() {
        jumpToMain();
    }

    @Override
    public void onBackPressed() {
        // super.onBackPressed();
        jumpToMain();
    }

    @Override
    public void jumpToMain()
    {
        Intent intent = new Intent(this, WebViewActivity.class);
        startActivity(intent);
        overridePendingTransition(R.anim.screen_zoom_in, R.anim.screen_zoom_out);
        finish();
    }
}
